<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <link rel="shortcut icon" type="image/png" href="#{request.contextPath}/resources/images/favicon.ico"/>
        <title>MeteoCal Calendar</title>
        <link type="text/css" rel="stylesheet"
		href="#{request.contextPath}/resources/css/styles.css" />       
    </h:head>
<body> 
    <div id="wrap">
        <div id="header">
			<ui:include src="/CommonHeader.xhtml"></ui:include>
		</div>
	
            <div id="inner-wrap">
			<div id="content">
                            <h:form id="CalendarF"> 
            <p:growl id="messages" showDetail="true" />
	 
        <p:dialog id="notifyDialog" header="New Notifications" widgetVar="dlg" modal="true" height="100" visible="#{homeBean.login.notifyUp}" onHide="#{homeBean.closeNotify()}">
            <h:outputText value="#{homeBean.getWelcomeMessage()}" />
            <br/>
                <p:commandButton style="vertical-align: middle; position: absolute; top: 50%; margin-left: 70px" id="goNoty" value="Go to NotificationCenter" action="#{homeBean.goToNotifyCenter}" ajax="false" oncomplete="PF('notifyDialog').hide();" />
            </p:dialog> 

        </h:form>
        <div id="calendarHome">
            <h:form> 
    <h:panelGrid columnClasses="value">
        <p:schedule id="schedule" value="#{homeBean.eventModel}" widgetVar="myschedule" timeZone="GMT+2">
 
            <p:ajax event="dateSelect" listener="#{homeBean.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
            <p:ajax event="eventSelect" listener="#{homeBean.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
 
        </p:schedule>
    </h:panelGrid>
 
    <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
        <h:panelGrid id="eventDetails" columns="2">
            
            <p:outputLabel for="title" value="Title: " />
				<p:inputText id="title" required="true"
                                             value="#{homeBean.event.title}" size="50" readonly="#{homeBean.isEventSelected()}"/>
                                <p:outputLabel for="from" value="From: " />
                                <p:calendar id="from" value="#{homeBean.event.startDate}" navigator="true" required="true" 
                                            pattern="dd/MM/yyyy HH:mm:ss" disabled="#{homeBean.isEventSelected()}" >
                                </p:calendar>
                                <p:outputLabel for="to" value="To: " />
                                <p:calendar id="to" value="#{homeBean.event.endDate}" navigator="true" required="true" 
                                            pattern="dd/MM/yyyy HH:mm:ss"  disabled="#{homeBean.isEventSelected()}">
                                </p:calendar>           
 
                <p:commandButton id="addButton" value="Add" actionListener="#{homeBean.moveToAddEvent}" ajax="false" oncomplete="PF('myschedule').update();PF('eventDialog').hide();" 
                                 rendered="#{!homeBean.isEventSelected()}"/>
                <p:commandButton id="editButton" value="Show" action="#{homeBean.moveToEditEvent}" ajax="false" oncomplete="PF('myschedule').update();PF('eventDialog').hide();" 
                                 rendered="#{homeBean.isEventSelected()}"/>
        </h:panelGrid>
    </p:dialog>   
    </h:form>
 </div>
<script type="text/javascript">
    PrimeFaces.locales['tr'] = {
        closeText: 'kapat',
        prevText: 'geri',
        nextText: 'ileri',
        currentText: 'bugün',
        monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
            'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
        monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
            'Tem','Ağu','Eyl','Eki','Kas','Ara'],
        dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
        dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
        dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
        weekHeader: 'Hf',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: '',
        month: 'Ay',
        week: 'Hafta',
        day: 'Gün',
        allDayText : 'Tüm Gün'
    };
</script>
<style type="text/css">
    .value {
        width: 1000px;
    }
</style>
                
            </div>
        </div>
     </div>   
</body> 
</html>